<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title><?php echo $this->_siteConfig->name;?></title>
    <link type="image/x-icon" href="<?php echo IUrl::creatUrl("")."favicon.ico";?>" rel="icon">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="apple-touch-icon-precomposed" href="<?php echo $this->getWebSkinPath()."image/logo.gif";?>">
    <script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/jquery/jquery-1.12.4.min.js"></script> <script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/form/form.js"></script> <script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/autovalidate/validate.js"></script><link rel="stylesheet" type="text/css" href="/git/micarshop/runtime/_systemjs/autovalidate/style.css" /> <script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/artdialog/artDialog.js"></script><script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/artdialog/plugins/iframeTools.js"></script><link rel="stylesheet" type="text/css" href="/git/micarshop/runtime/_systemjs/artdialog/skins/aero.css" /> <script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/artTemplate/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/artTemplate/artTemplate-plugin.js"></script>
    <script src="<?php echo $this->getWebViewPath()."javascript/common.js";?>"></script>
    <script src='<?php echo $this->getWebViewPath()."javascript/site.js";?>'></script>
    <link rel="stylesheet" href="<?php echo $this->getWebSkinPath()."style/style.css";?>">
</head>

<body>
    <!-- 顶部通栏 -->
    <header class="header_box">
        <div class="header">
            <?php if(IWeb::$app->getController()->getId() == 'site' && IWeb::$app->getController()->getAction()->getId() == 'index'){?>
            <div class="header_home"><i class="icon-home"></i></div>
            <?php }else{?>
            <div class="header_back" onclick="window.history.back();"><i class="icon-chevron-left"></i></div>
            <?php }?>
            <h1 id="page_title" class="page_title"><?php echo $this->_siteConfig->name;?></h1>
        
            <!-- <div class="header_so_btn" onclick="$('.header_search').toggle();"><i class="icon-search"></i></div> -->
            <div class="header_so_btn" onclick="jump_url()"><i class="icon-search"></i></div>
        
        </div>
    </header>
    <!-- 顶部搜索 -->
    <section class="header_search">
        <form method='get' action="<?php echo IUrl::creatUrl("/");?>">
            <input type='hidden' name='controller' value='site'>
            <input type='hidden' name='action' value='search_list'>
            <input class="keywords" type="text" name='word' autocomplete="off" placeholder="请输入关键词...">
            <input class="submit" type="submit" value="搜索">
        </form>
    </section>
    <!-- 引入内页 -->
    <section class="viewport">
        <script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/artTemplate/artTemplate.js"></script><script type="text/javascript" charset="UTF-8" src="/git/micarshop/runtime/_systemjs/artTemplate/artTemplate-plugin.js"></script>
<?php if($this->good_type == 2){?>
<script type='text/javascript' src='<?php echo $this->getWebViewPath()."javascript/vrOrderFormClass.js";?>'></script>
<?php }else{?>
<script type='text/javascript' src='<?php echo $this->getWebViewPath()."javascript/orderFormClass.js";?>'></script>
<?php }?>
<script type='text/javascript'>
console.log("<?php echo $this->freefreight;?>");
var isjifen =0;
var jifenprice = 0;

<?php if($this->isjifen != ""){?>
	isjifen = <?php echo $this->isjifen;?>;
	jifenprice = <?php echo $this->jifenprice;?>
	
<?php }?>

//创建订单表单实例
orderFormInstance = new orderFormClass(isjifen,jifenprice);

//DOM加载完毕
$(function(){
    // 隐藏底部导航
    hideNav();
    //商家信息
    orderFormInstance.seller = <?php echo JSON::encode($this->seller);?>;

    //商品价格
    orderFormInstance.goodsSum = "<?php echo $this->final_sum;?>";

    //配送方式初始化
    orderFormInstance.deliveryInit("<?php echo isset($this->custom['delivery'])?$this->custom['delivery']:"";?>");

    //收货地址数据
    orderFormInstance.addressInit();

    //支付方式
    orderFormInstance.paymentInit("<?php echo isset($this->custom['payment'])?$this->custom['payment']:"";?>");

    //免运费
    orderFormInstance.freeFreight = <?php echo JSON::encode($this->freeFreight);?>;
});
</script>

<div id="pageInfo" data-title="填写和提交订单信息"></div>

<!-- 
<?php echo "-------------------------------------------";?>
兑换分：<?php echo $this->duihuanpoint;?>
商品类型：<?php echo $this->good_type;?>
应付价格：<?php echo $this->jifenprice;?>
运费：<?php echo $this->isjifen;?>

 类型：<?php echo $this->good_type;?>
是否积分：<?php echo $this->isjifen ;?>
 -->
<section class="member_main cart_2">
    <div class="height15"></div>
    <div class="container info">
        <form action='<?php echo IUrl::creatUrl("/simple/cart3");?>' class="form" method='post' name='order_form' onsubmit='return orderFormInstance.isSubmit()'>

            <input type='hidden' name='direct_gid' value='<?php echo $this->gid;?>' />
            <input type='hidden' name='direct_type' value='<?php echo $this->type;?>' />
            <input type='hidden' name='direct_num' value='<?php echo $this->num;?>' />
            <input type='hidden' name='direct_promo' value='<?php echo $this->promo;?>' />
            <input type='hidden' name='direct_active_id' value='<?php echo $this->active_id;?>' />
			<input type='hidden' name='direct_good_type' value='<?php echo $this->good_type;?>' />
			<input type="hidden" name="isjifen" value="<?php echo $this->isjifen;?>">
			<input type="hidden" name="duihuanpoint" value="<?php echo $this->duihuanpoint;?>"/>
			<input type="hidden" name="jifenprice" value="<?php echo $this->jifenprice;?>"/>
		
			

            <div class="cart_box m_10">
            <?php if($this->good_type != 2){?>
                <div class="cont">
                    <!--地址管理 开始-->
                    <div class="cart_sect cart_2_address">
                        <div class="info_head cart_sect_header">收货人信息</div>

                        <!--收货表单信息 开始-->
                        <div id='address_often' class="prompt_4 m_10">
                            <ul class="addr_list block-row">
                                <?php foreach($this->addressList as $key => $item){?>
                                <li id="addressItem<?php echo isset($item['id'])?$item['id']:"";?>">
                                    <label>
                                        <input name="radio_address" type="radio" value="<?php echo isset($item['id'])?$item['id']:"";?>"
                                        onclick="orderFormInstance.getDelivery(<?php echo isset($item['province'])?$item['province']:"";?>);"/>
                                        <div class="address_info">
                                            <strong><?php echo isset($item['accept_name'])?$item['accept_name']:"";?></strong>
                                            <p><?php echo isset($item['province_val'])?$item['province_val']:"";?> <?php echo isset($item['city_val'])?$item['city_val']:"";?> <?php echo isset($item['area_val'])?$item['area_val']:"";?> <?php echo isset($item['address'])?$item['address']:"";?></p>
                                        </div>
                                    </label>
                                    <div class="col">
                                        <a href="javascript:orderFormInstance.addressEdit(<?php echo isset($item['id'])?$item['id']:"";?>);">修改</a>
                                        <a href="javascript:orderFormInstance.addressDel(<?php echo isset($item['id'])?$item['id']:"";?>);">删除</a>
                                    </div>
                                </li>
                                <?php }?>
                                <li>
                                    <div class="btn btn_all btn_pink" onclick="orderFormInstance.addressAdd();">添加新地址</div>
                                </li>
                            </ul>
                            <!--收货地址项模板-->
                            <script type='text/html' id='addressLiTemplate'>
                                <li id="addressItem<%=item['id']%>">
                                    <label>
                                        <input name="radio_address" type="radio" value="<%=item['id']%>"
                                        onclick="orderFormInstance.getDelivery(<%=item['province']%>);" />
                                        <div class="address_info">
                                        <strong><%=item['accept_name']%></strong>
                                        <p><%=item['province_val']%> <%=item['city_val']%> <%=item['area_val']%> <%=item['address']%></p>
                                        </div>
                                    </label>
                                    <div class="col">
                                        <a href="javascript:orderFormInstance.addressEdit(<%=item['id']%>);">修改</a>
                                        <a href="javascript:orderFormInstance.addressDel(<%=item['id']%>);">删除</a>
                                    </div>
                                </li>
                            </script>
                        </div>


                    </div>
                    <!--地址管理 结束-->
                </div>
                <!--配送方式 开始-->
                <div class="cart_sect cart_2_delivery" >
                    <div class="info_head cart_sect_header">配送方式</div>

                    <!--配送修改 开始-->
                    <div class="delivery">
                        <ul>
                        	
                       	<?php if($this->isjifen != ""){?>
						<?php $api = "getDeliveryListByjifen"?>
						<?php }else{?>
							<?php $api = "getDeliveryList"?>
						<?php }?>
                        	
                           <?php foreach(Api::run($api) as $key => $item){?>
                            <li>
                                <label>
                                    <input type="radio" name="delivery_id" value="<?php echo isset($item['id'])?$item['id']:"";?>" paytype="<?php echo isset($item['type'])?$item['type']:"";?>"
                                    onclick='orderFormInstance.deliverySelected(<?php echo isset($item['id'])?$item['id']:"";?>);' />
                                    <div class="info">
                                        <strong id="deliveryShow<?php echo isset($item['id'])?$item['id']:"";?>"></strong>
                                        <p><?php echo isset($item['name'])?$item['name']:"";?> <?php echo isset($item['description'])?$item['description']:"";?></p>
                                        <?php if($item['type'] == 2){?>
                                        <span class="ziti_btn" onclick="orderFormInstance.selectTakeself(<?php echo isset($item['id'])?$item['id']:"";?>)">选择自提点</span>
                                        <span id="takeself<?php echo isset($item['id'])?$item['id']:"";?>"></span>
                                        <?php }?>
                                    </div>
                                </label>
                            </li>
                            <?php }?>
                        </ul>
                        <!--配送信息-->
                        <script type='text/html' id='deliveryTemplate'>
                            <strong>运费：￥<%=item['price']%></strong>
                            <%if(item['protect_price'] > 0){%>
                            <strong>保价：￥<%=item['protect_price']%></strong>
                            <%}%>
                        </script>

                        <!--物流自提点-->
                        <script type='text/html' id='takeselfTemplate'>
                            [<%=item['address']%> <%=item['name']%> <%=item['phone']%> <%=item['mobile']%>]
                        </script>
                        <ul class="block-row">
                            <li>
                                指定送货时间：
                                <label>
                                    <input type='radio' class="option-input radio" name='accept_time' checked="checked" value='任意' />
                                    <span>任意</span>
                                </label>
                                <label>
                                    <input type='radio' class="option-input radio" name='accept_time' value='周一到周五' />
                                    <span>周一到周五</span>
                                </label>
                                <label>
                                    <input type='radio' class="option-input radio" name='accept_time' value='周末' />
                                    <span>周末</span>
                                </label>
                            </li>
                        </ul>
                    </div>

                </div>
                <!--配送方式 结束-->
                <?php }?>
                <!--支付方式 开始-->
                <div class="cart_sect cart_2_pay" id="paymentBox">
                    <div class="info_head cart_sect_header">支付方式</div>
                    <div class="pay_box">
                        <?php foreach(Api::run('getPaymentList') as $key => $item){?>
                        <?php $paymentPrice = CountSum::getGoodsPaymentPrice($item['id'],$this->sum);?>
                        <label>
                            <input name="payment" alt="<?php echo isset($paymentPrice)?$paymentPrice:"";?>" type="radio" value="<?php echo isset($item['id'])?$item['id']:"";?>"
                            onclick='orderFormInstance.paymentSelected(<?php echo isset($item['id'])?$item['id']:"";?>);' title="<?php echo isset($item['name'])?$item['name']:"";?>" />
                            <div class="info"><?php echo isset($item['name'])?$item['name']:"";?> <?php echo isset($item['note'])?$item['note']:"";?> <?php if($paymentPrice){?>支付手续费：￥<?php echo isset($paymentPrice)?$paymentPrice:"";?><?php }?></div>
                        </label>
                        <?php }?>
                    </div>
                </div>
                <!--支付方式 结束-->
                <!--订单留言 开始-->
                <div class="cart_sect cart_2_message">
                    <div class="info_head cart_sect_header">订单附言</div>
                    <div class="message_box"><input class="form-control" placeholder="请输入订单附言" type="text" name='message' /></div>
                </div>
                <!--订单留言 结束-->
                <!--购买清单 开始-->
                <div class="cart_sect cart_2_pro">
                    <div class="info_head cart_sect_header">购买的商品</div>
                    <ol <?php if(empty($this->promotion)){?>style="display:none"<?php }?>>
                        <span>本单享受的活动：</span>
                        <?php foreach($this->promotion as $key => $item){?>
                        <li><?php echo isset($item['plan'])?$item['plan']:"";?>，<?php echo isset($item['info'])?$item['info']:"";?></li>
                        <?php }?>
                    </ol>
                    <!-- 商品展示 开始-->
                    <ul>
                    <?php foreach($this->goodsList as $key => $item){?>
                        <li>
                            <img src="<?php echo IUrl::creatUrl("/pic/thumb/img/".$item['img']."/w/80/h/80");?>">
                            <div class="info">
                                <h4><?php echo isset($item['name'])?$item['name']:"";?></h4>
                                <?php if(isset($item['spec_array'])){?>
                                <?php $spec_array=Block::show_spec($item['spec_array']);?>
                                <div class="tip">
                                    <?php foreach($spec_array as $specName => $specValue){?>
                                        <!-- <?php echo isset($specName)?$specName:"";?>： -->
                                        <span><?php echo isset($specValue)?$specValue:"";?></span>
                                    <?php }?>
                                </div>
                                <?php }?>
                                <div class="count">
                                    <h10 class="disnone" id="deliveryFeeBox_<?php echo isset($item['goods_id'])?$item['goods_id']:"";?>_<?php echo isset($item['product_id'])?$item['product_id']:"";?>_<?php echo isset($item['count'])?$item['count']:"";?>"></h10>
                                    <strong>数量：</strong><i><?php echo isset($item['count'])?$item['count']:"";?></i>
                                    <?php if($this->isjifen == 1){?>
                                    <strong>小计：</strong><em>￥<?php echo $this->jifenprice;?></em>
                                    <?php }else{?>
                                    <strong>小计：</strong><em>￥<?php echo isset($item['sum'])?$item['sum']:"";?></em>
                                    <?php }?>
                                </div>
                            </div>
                        </li>
                    <?php }?>
                    </ul>
                    <!-- 商品展示 结束-->
                </div>
                <!--购买清单 结束-->
                <!--金额结算-->
                <div class="cart_sect cart_2_count">
                    <div class="info_head cart_sect_header">结算信息</div>
                    <?php if($this->isjifen == 1){?>
                    	 <div class="count">
                        <?php if($this->final_sum != $this->sum){?>优惠后总金额<?php }else{?>商品总金额<?php }?>：<strong><?php echo $this->final_sum;?></strong><br>
                        + 税金：<strong id='tax_fee'>0</strong><br>
                        + 运费总计：<strong id='delivery_fee_show'>0</strong><br>
                        - 兑换积分：<strong name='duihuanpoint'><?php echo $this->duihuanpoint;?></strong><br>
                  		<!-- <strong style="color: red" name='duihuanpoint'>抵扣1元</strong> -->
                  		</div>
                    <?php }else{?>
                    	 <div class="count">
                        <?php if($this->final_sum != $this->sum){?>优惠后总金额<?php }else{?>商品总金额<?php }?>：<strong><?php echo $this->final_sum;?></strong><br>
                        - 代金券：<strong name='ticket_value'>0</strong><br>
                        <?php if($this->good_type != 2){?>
                        + 税金：<strong id='tax_fee'>0</strong><br>
                        + 运费总计：<strong id='delivery_fee_show'>0</strong><br>
                        + 保价：<strong id='protect_price_value'>0</strong><br>
                        + 支付手续费：<strong id='payment_value'>0</strong>
                        
                         <div class="btn_box">
                        <div class="btn btn_all btn_pink" onclick="orderFormInstance.ticketShow();">使用代金券</div>
                    </div>
                        
                        <?php }?>
                    </div>
                    <?php }?>
                   
                   
                </div>
                <?php if($this->good_type != 2){?>
                <!-- 发票信息 -->
                <div class="cart_sect cart_2_tax">
                    <div class="info_head cart_sect_header">发票信息</div>
                    <div class="tax_box">
                        <p>是否需要发票？(税金:￥<?php echo $this->goodsTax;?>)</p>
                        <label>
                            <input class="radio" class="option-input radio" style="position:relative" onchange="orderFormInstance.doAccount();$('#tax_title').toggle();" name="taxes" type="checkbox" value="<?php echo $this->goodsTax;?>" />
                            <span></span>
                        </label>
                    </div>
                    <label id="tax_title" class="tax_title" style='display:none'>
                        <input type='text' placeholder="请输入发票抬头" class="form-control" name='tax_title' />
                    </label>
                </div>
                <!-- 发票信息 结束 -->
                <?php }?>
                <footer class="cart_footer">
                    <div class="cart_footer_fixed">
                        <label class="buy">
                            确认<input type="submit"/>
                        </label>
                        <div class="trade_count">
                            <span>实付:</span>
                            <?php if($this->isjifen == 1){?>
                            	<?php 
                            		$chajia = ($this->sum * 100 - $this->jifenprice * 100) / 100;
									$chajia; 
                            	?>
                           		<em id='final_sum'><?php echo $this->final_sum;?>元</em>
                            	<?php }else{?>
                            	<em id='final_sum'><?php echo $this->final_sum;?>元</em>
                            <?php }?>
                            
                        </div>
                    </div>
                </footer>
            </div>
        </form>
    </div>
</section>

    </section>
    <!-- 会员登陆与否显示不同内容 -->
    <?php if($this->user){?>
    <?php }else{?>
    <!-- 
    <section class="footer_login">
        <a class="login" href="<?php echo IUrl::creatUrl("simple/login");?>">登录</a>
        <a class="reg" href="<?php echo IUrl::creatUrl("simple/reg");?>">注册</a>
    </section> -->
    <?php }?>
    <!--底部菜单-->
    <nav class="footer_nav">
        <ul>
            <li class="nav_home"><a href="<?php echo IUrl::creatUrl("site");?>"><i class="icon-home"></i><span>首页</span></a></li>
            <li class="nav_cart"><a href="<?php echo IUrl::creatUrl("simple/cart");?>"><i class="icon-shopping-cart"></i><span>购物车</span></a></li>
            <li class="nav_user"><a href="<?php echo IUrl::creatUrl("/ucenter/index");?>"><i class="icon-user"></i><span>个人中心</span></a></li>
            <li class="nav_map"><a href="<?php echo IUrl::creatUrl("site/sitemap");?>"><i class="icon-reorder"></i><span>分类</span></a></li>
        </ul>
    </nav>
    <script src='<?php echo $this->getWebViewPath()."javascript/mobile.js";?>'></script>
</body>

</html>

<script type="text/javascript">

var ex = "http://"+window.location.host+"/";
function jump_url(){
	
	//window.location.href = ex+"site/goseachpage";
	window.location.href = ex+"git/micarshop/site/goseachpage";
	
}

</script>

